﻿// owner 蒋家伟

#pragma once
#include "DataSchema_home.h"
#include "ElementId.h"

namespace jsdk
{
    class IElement;
    class IDocument;
    enum class ElementChangedType : uint8_t
    {
        Undefined = 0,
        AddElement = 1,
        PreElementChanged = 2,
        PostElementChanged = 3,
        DeleteElement = 4
    };

    using ChangedStatusUMap = typename std::unordered_map<ElementId, ElementChangedType, ElementHash>;

    // 类别描述 : element对象改变事件通知的封装
    class DATASCHEMA_EXPORT ElementNotifyUtils
    {
    public:
        /// \ brief Element发生变化时的通知方法
        /// \ in doc            element对象所在的文档
        /// \ in elementId      变化对象的ID
        /// \ in changedType    变化类型
        static void ElementDataChangedNotify(const IElement* pElement, const ElementChangedType& changedType);
        static void ElementDataChangedNotify(const IDocument* pDoc, ChangedStatusUMap&& changedStatusUMap);
    };
}
